package com.lovo.psc.controller;


import com.lovo.psc.dto.OrderDto;
import com.lovo.psc.service.IPscOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lovo
 * @since 2022-07-07
 */
@RestController
@RequestMapping("/supplyOrder")
@Api(tags = "供应商后端")
public class PscOrderController {
    @Autowired
    IPscOrderService service;

    @GetMapping("findIdOrder")
    @ApiOperation(value = "按照供应商查询订单")
    public List<OrderDto> findIdOrder(Integer supplyCode){
        List<OrderDto> pscOrderList = service.findIdOrder(supplyCode);
        return pscOrderList;
    }

    @GetMapping("findIdByStateOrder/{supplyCode}/{supplyState}")
    @ApiOperation(value = "按照供应商和货物状态查询订单")
    public List<OrderDto> findIdByStateOrder(@PathVariable("supplyCode") Integer supplyCode,
                                             @PathVariable("supplyState") String supplyState){
        List<OrderDto> pscOrderList = service.findIdByStateOrder(supplyCode,supplyState);
        return pscOrderList;
    }
}
